<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  

  
  <title>Hexo和GitHub搭建博客 | Chen_Blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="前言1.提前的准备工作，查看上一篇博文，需要安装git 和 node.js的环境。  使用 npm 安装hexo1npm install -g hexo-cli   开始搭建搭建本地博客项目新建一个文件夹（Hexo）,安装以下操作。123mkdir Hexohexo init ga-hexohexo server # 开启本地服务，localhost:4000 ,进行访问 本地搭建完">
<meta property="og:type" content="article">
<meta property="og:title" content="Hexo和GitHub搭建博客">
<meta property="og:url" content="http://yoursite.com/2018/07/03/Hexo和GitHub搭建博客/index.html">
<meta property="og:site_name" content="Chen_Blog">
<meta property="og:description" content="前言1.提前的准备工作，查看上一篇博文，需要安装git 和 node.js的环境。  使用 npm 安装hexo1npm install -g hexo-cli   开始搭建搭建本地博客项目新建一个文件夹（Hexo）,安装以下操作。123mkdir Hexohexo init ga-hexohexo server # 开启本地服务，localhost:4000 ,进行访问 本地搭建完">
<meta property="og:locale" content="default">
<meta property="og:updated_time" content="2018-07-03T15:21:56.804Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Hexo和GitHub搭建博客">
<meta name="twitter:description" content="前言1.提前的准备工作，查看上一篇博文，需要安装git 和 node.js的环境。  使用 npm 安装hexo1npm install -g hexo-cli   开始搭建搭建本地博客项目新建一个文件夹（Hexo）,安装以下操作。123mkdir Hexohexo init ga-hexohexo server # 开启本地服务，localhost:4000 ,进行访问 本地搭建完">
  
    <link rel="alternate" href="/atom.xml" title="Chen_Blog" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Chen_Blog</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/" id="subtitle">业精于勤，荒于嬉；行成于思，毁于随。</a>
        </h2>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-Hexo和GitHub搭建博客" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2018/07/03/Hexo和GitHub搭建博客/" class="article-date">
  <time datetime="2018-07-03T15:16:21.000Z" itemprop="datePublished">2018-07-03</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      Hexo和GitHub搭建博客
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>1.提前的准备工作，查看上一篇博文，需要安装git 和 node.js的环境。</p>
<ol start="2">
<li>使用 npm 安装hexo<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g hexo-cli</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h1 id="开始搭建"><a href="#开始搭建" class="headerlink" title="开始搭建"></a>开始搭建</h1><h2 id="搭建本地博客项目"><a href="#搭建本地博客项目" class="headerlink" title="搭建本地博客项目"></a>搭建本地博客项目</h2><p>新建一个文件夹（Hexo）,安装以下操作。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">mkdir Hexo</span><br><span class="line">hexo init ga-hexo</span><br><span class="line">hexo server # 开启本地服务，localhost:4000 ,进行访问</span><br></pre></td></tr></table></figure></p>
<p>本地搭建完成</p>
<h2 id="将本地博客项目部署到线上"><a href="#将本地博客项目部署到线上" class="headerlink" title="将本地博客项目部署到线上"></a>将本地博客项目部署到线上</h2><ol>
<li>注册GitHub账户，新建一个项目，项目名称为用户名.github.io 这个是必须的。</li>
<li><p>修改本地hexo站点的配置文件_config.yml，在Deployment部分添加git仓库和提交的分支角色</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">#Deployment</span><br><span class="line">deploy:</span><br><span class="line">  type: git</span><br><span class="line">  repository: https://github.com/chenygie/chenygie.github.io</span><br><span class="line">  branch: master</span><br></pre></td></tr></table></figure>
</li>
<li><p>部署，可能需要验证密码，等待少许时间。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git --save</span><br><span class="line">hexo d #部署的命令</span><br></pre></td></tr></table></figure>
</li>
</ol>
<p>完成。</p>
<ol start="4">
<li><p>发布自己的博文</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo new &quot;postName&quot;</span><br></pre></td></tr></table></figure>
</li>
<li><p>文章编辑完后，发布：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">hexo server # 本地查看</span><br><span class="line">hexo generate # 生成静态文本</span><br><span class="line">hexo deploy # 部署到远程服务器中</span><br><span class="line">hexo s</span><br><span class="line">hexo g</span><br><span class="line">hexo d</span><br></pre></td></tr></table></figure>
</li>
</ol>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2018/07/03/Hexo和GitHub搭建博客/" data-id="cjptgn1ld0002ev15sivezjo8" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2018/07/04/Hong-yi-Lee-course/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          Hong-yi_Lee_course
        
      </div>
    </a>
  
  
    <a href="/2018/07/03/hello-world/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">Hello World</div>
    </a>
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tags</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Machine-Learning/">Machine Learning</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linear-regression/">linear regression</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/tags/Machine-Learning/" style="font-size: 20px;">Machine Learning</a> <a href="/tags/linear-regression/" style="font-size: 10px;">linear regression</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/12/">December 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/08/">August 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/07/">July 2018</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2018/12/18/SGD/">SGD</a>
          </li>
        
          <li>
            <a href="/2018/12/18/gradient-descent/">gradient_descent</a>
          </li>
        
          <li>
            <a href="/2018/12/06/linear-regression-gluon/">linear-regression-gluon</a>
          </li>
        
          <li>
            <a href="/2018/12/06/linear-regression-sources-md/">linear-regression-sources.md</a>
          </li>
        
          <li>
            <a href="/2018/12/05/regression/">regression</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2018 alex Chen<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>



  </div>
</body>
</html>